<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Mini-Web 测试管理</title>
	<%@ include file="/common/meta.jsp" %>
	<link href="${ctx}/css/style.css" type="text/css" rel="stylesheet"/>
	<link href="${ctx}/js/validate/jquery.validate.css" type="text/css" rel="stylesheet"/>
	<script src="${ctx}/js/jquery.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/jquery.validate.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
	<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#name").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate({
				rules: {
					name: {
						required: true,
						remote: "stest!checkName.action?name=" + encodeURIComponent('${name}')
					},
					sex: "required",
					
				},
				messages: {
					name: {
						remote: "用户登录名已存在"
					}
				}
			});
		});
	</script>
</head>

<body style="margin-top:40px;">

<div id="content">
	<h1><s:if test="id == null">创建</s:if><s:else>修改</s:else>测试</h1>
	<form id="inputForm" action="stest!save.action" method="post">
		<input type="hidden" name="id" value="${id}"/>
		<table class="noborder">
			
			<tr>
				<td>用户名:</td>
				<td><input type="text" id="name" name="name" size="40" value="${name}"/></td>
			</tr>
			<tr>
				<td>性别:</td>
				<td><input type="text" id="sex" name="sex" size="40" value="${sex}"/></td>
			</tr>
			
			
			<tr>
				<td colspan="2">
					<security:authorize ifAnyGranted="A_MODIFY_USER">
						<input class="button" type="submit" value="提交"/>&nbsp;
					</security:authorize>
					<input class="button" type="button" value="返回" onclick="history.back()"/>
				</td>
			</tr>
		</table>
	</form>
</div>

</body>
</html>